package com.jiezheng.huinong.action;

import java.util.ArrayList;
import java.util.List;

import com.jiezheng.huinong.dao.ApplyManageDAOImpl;
import com.jiezheng.huinong.model.ApplyDetail;
import com.jiezheng.huinong.util.JqPage;
import com.opensymphony.xwork2.ActionSupport;

public class ApplyDetailAction extends ActionSupport {

	/**
	 * serialVersionUID
	 */
	private static final long serialVersionUID = -9164518869226124392L;
	
	private JqPage pageInfo = new JqPage();
	private List<ApplyDetail> applies = new ArrayList<ApplyDetail>();
	private String sord = "";
	private String sidx = "";

	// 检索的条件
	private String applyNo = "";

	/**
	 * 列出所有指标
	 * 
	 * @return
	 */
	public String listApplyDetail() {
		Integer total = (new ApplyManageDAOImpl()).getTotalApplyDetailNum(applyNo);
		Integer totalPage = (Integer) (total / pageInfo.getRows())
				+ ((total % pageInfo.getRows() == 0) ? 0 : 1);
		pageInfo.setTotalPage(totalPage);
		pageInfo.setRecord(total);
		// 取得当前页
		Integer curPage = pageInfo.getPage();
		Integer startRow = (curPage - 1) * pageInfo.getRows();

		applies = (new ApplyManageDAOImpl()).getApplyDetailInfo(applyNo, startRow,
				pageInfo.getRows());
		return SUCCESS;
	}

	public JqPage getPageInfo() {
		return pageInfo;
	}

	public void setPageInfo(JqPage pageInfo) {
		this.pageInfo = pageInfo;
	}

	public String getSord() {
		return sord;
	}

	public void setSord(String sord) {
		this.sord = sord;
	}

	public String getSidx() {
		return sidx;
	}

	public void setSidx(String sidx) {
		this.sidx = sidx;
	}

	public List<ApplyDetail> getApplies() {
		return applies;
	}

	public void setApplies(List<ApplyDetail> applies) {
		this.applies = applies;
	}

	public String getApplyNo() {
		return applyNo;
	}

	public void setApplyNo(String applyNo) {
		this.applyNo = applyNo;
	}


}
